//package com.example.test622.util
//
//import android.content.Context
//import android.graphics.Canvas
//import android.graphics.Color
//import android.graphics.Paint
//import android.util.AttributeSet
//import android.view.View
//import com.example.test622.R
//
//class BadgeView @JvmOverloads constructor(
//	context: Context,
//	attrs: AttributeSet? = null,
//	defStyleAttr: Int = 0
//) : View(context, attrs, defStyleAttr) {
//
//	private var badgeText: String = ""
//	private val badgePaint = Paint().apply {
//		color = Color.RED
//		style = Paint.Style.FILL_AND_STROKE
//		textAlign = Paint.Align.CENTER
//		textSize = resources.getDimensionPixelSize(R.dimen.badge_text_size).toFloat()
//	}
//
//	fun setBadgeCount(count: Int) {
//		badgeText = if (count > 0) count.toString() else ""
//		invalidate() // 请求重新绘制
//	}
//
//	override fun onDraw(canvas: Canvas) {
//		super.onDraw(canvas)
//
//		if (badgeText.isEmpty()) return
//
//		val badgeWidth = badgePaint.measureText(badgeText) + resources.getDimensionPixelSize(R.dimen.badge_padding)*2
//		val badgeHeight = resources.getDimensionPixelSize(R.dimen.badge_height)
//		val centerX = width / 2f
//		val centerY = height / 2f
//
//		canvas.drawCircle(centerX, centerY, resources.getDimensionPixelSize(R.dimen.badge_radius), badgePaint)
//
//		// 绘制文本
//		badgePaint.color = Color.WHITE
//		canvas.drawText(badgeText, centerX, centerY + (badgePaint.textSize / 3), badgePaint)
//	}
//}